<?php
class OrderStatusHistoryEntityBase extends EntityBase
{
	public $id;
	public $orders_id;
	public $orders_status;
	public $date_added;
	public $customer_notified;
	public $comments;
	
	const INACTIVE = 0;
	const ACTIVE = 1;
	public function __construct($arrValue = null, $prefix = '')
	{
		if(!is_null($arrValue) && is_array($arrValue))
		{
			$this->id = (int) ($arrValue[$prefix . 'id']);			
			$this->orders_id = strval ($arrValue[$prefix . 'orders_id']);
			$this->orders_status = strval ($arrValue[$prefix . 'orders_status']);
			$this->date_added = strval ($arrValue[$prefix . 'date_added']);
			$this->customer_notified = strval($arrValue[$prefix . 'customer_notified']);
			$this->comments = strval ($arrValue[$prefix . 'comments']);
		}
	}

	/**
	 * Get status name of users
	 *
	 * @access public
	 *
	 * @return string name of status
	 *
	 */
	public function getStatusName()
	{
		$arrStatusList = self::getStatusList();
		return isset($arrStatusList["{$this->status}"]) ? $arrStatusList["{$this->status}"] : '';
	}

	/**
	 * Get list of users status
	 *
	 * @access public
	 *
	 * @return array of users status
	 *
	 */
	public static function getStatusList()
	{
		return array(self::INACTIVE	=> 'INACTIVE',
		self::ACTIVE 	=>'ACTIVE'		
		);
	}

	/**
	 * Get all fields for selecting columns
	 *
	 * @param string $alias: alias of table
	 * @param string $prefix
	 * @return string
	 */
	public static function getSelectColumns($alias, $prefix = '')
	{
		$arrValue = array(
						"{$alias}.id AS `{$prefix}id`",
						"{$alias}.orders_id AS `{$prefix}orders_id`",
						"{$alias}.orders_status AS `{$prefix}orders_status`",
						"{$alias}.date_added AS `{$prefix}date_added`",
						"{$alias}.customer_notified AS `{$prefix}customer_notified`",
						"{$alias}.comments AS `{$prefix}comments`"
		);

		return implode(',', $arrValue);
	}
}